home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / RemoteRef.java < prev    next >
Text File  |  1998-09-22  |  3KB  |  99 lines

  1. /*
  2.  * @(#)RemoteRef.java    1.6 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.rmi.server;
  16.  
  17. import java.rmi.*;
  18.  
  19. /**
  20.  * RemoteRef represents the handle for a remote object.
  21.  */
  22. public interface RemoteRef extends java.io.Externalizable {
  23.  
  24.     /**
  25.      * Find server package prefix: assumes that the implementation of
  26.      * server ref classes (e.g., UnicastRef, UnicastServerRef) are
  27.      * located in the package defined by the prefix.
  28.      */
  29.     final static String packagePrefix =
  30.     System.getProperty("java.rmi.server.packagePrefix", "sun.rmi.server");
  31.     
  32.     /**
  33.      * Creates an appropriate call object for a new remote method
  34.      * invocation on this object.  Passing operation array and index,
  35.      * allows the stubs generator to assign the operation indexes and
  36.      * interpret them. The remote reference may need the operation to
  37.      * encode in the call.
  38.      *
  39.      * @exception RemoteException if registry could not be contacted.
  40.      */
  41.     RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash) 
  42.     throws RemoteException;
  43.     
  44.     /**
  45.      * Executes the remote call.
  46.      * 
  47.      * Invoke will raise any "user" exceptions which
  48.      * should pass through and not be caught by the stub.  If any
  49.      * exception is raised during the remote invocation, invoke should
  50.      * take care of cleaning up the connection before raising the
  51.      * "user" or remote exception.
  52.      *
  53.      * @exception java.lang.Exception if a general exception occurs.
  54.      */
  55.     void invoke(RemoteCall call) throws Exception;
  56.     
  57.     /**
  58.      * Allows the remote reference to clean up (or reuse) the connection.
  59.      * Done should only be called if the invoke returns successfully
  60.      * (non-exceptionally) to the stub.
  61.      *
  62.      * @exception RemoteException if registry could not be contacted.
  63.      */
  64.     void done(RemoteCall call) throws RemoteException;
  65.     
  66.     /**
  67.      * Returns the class name of the ref type to be serialized onto
  68.      * the stream 'out'.
  69.      */
  70.     String getRefClass(java.io.ObjectOutput out);
  71.     
  72.     /**
  73.      * Returns a hashcode for a remote object.  Two remote object stubs
  74.      * that refer to the same remote object will have the same hash code
  75.      * (in order to support remote objects as keys in hash tables).
  76.      *
  77.      * @see        java.util.Hashtable
  78.      */
  79.     int remoteHashCode();
  80.  
  81.     /**
  82.      * Compares two remote objects for equality.
  83.      * Returns a boolean that indicates whether this remote object is
  84.      * equivalent to the specified Object. This method is used when a
  85.      * remote object is stored in a hashtable.
  86.      * @param    obj    the Object to compare with
  87.      * @return    true if these Objects are equal; false otherwise.
  88.      * @see        java.util.Hashtable
  89.      */
  90.     boolean remoteEquals(RemoteRef obj);
  91.  
  92.     /**
  93.      * Returns a String that represents the reference of this remote
  94.      * object.
  95.      */
  96.     String remoteToString();
  97.     
  98. }
  99.